<?php
/*
Plugin Name: Avim
Plugin URI: http://tools.jcisio.com
Description: Avim
Author: Jcisio
Version: 1.0
Author URI: http://jcisio.com
*/

add_action('admin_footer', wpa_add_script);
add_action('wp_footer', wpa_add_script);
add_action('dbx_post_sidebar', wpa_add_box);
add_action('dbx_page_sidebar', wpa_add_box);

function wpa_add_script() {
    $url = get_bloginfo('url').'/wp-content/plugins/wp-avim/avim.js';
    $url = 'http://tools.jcisio.com/avim/avim.js';
    echo "<script type='text/javascript' src='{$url}' mce_src='{$url}'></script>";
}

function wpa_add_box() {
?>
<fieldset id="customsmileysbox" class="dbx-box">
    <h3 class="dbx-handle">AVIM</h3>
    <div class="dbx-content">
        <ul style="list-style-type:none">
            <li><input id="him_auto" onclick="setMethod(0);" type="radio" name="viet_method">Auto</li>
            <li><input id="him_telex" onclick="setMethod(1);" type="radio" name="viet_method">TELEX</li>
            <li><input id="him_vni" onclick="setMethod(2);" type="radio" name="viet_method">VNI</li>
            <li><input id="him_viqr" onclick="setMethod(3);" type="radio" name="viet_method">VIQR</li>
            <li><input id="him_viqr2" onclick="setMethod(4);" type="radio" name="viet_method">VIQR*</li>
            <li><input id="him_off" onclick="setMethod(-1);" type="radio" name="viet_method">Off</li>
            <li><input id="him_ckspell" onclick="setSpell(this);" type="checkbox" name="viet_method">Check spelling</li>
            <li><input id="him_daucu" onclick="setDauCu(this);" type="checkbox" name="viet_method">Old Accent</li>
        </ul>
    </div>
</fieldset>
<?php
}

function wpa_print_options($s = '') {
    echo $s;
?>
    <input id="him_auto" onclick="setMethod(0);" type="radio" name="viet_method">Auto
    <input id="him_telex" onclick="setMethod(1);" type="radio" name="viet_method">TELEX
    <input id="him_vni" onclick="setMethod(2);" type="radio" name="viet_method">VNI
    <input id="him_viqr" onclick="setMethod(3);" type="radio" name="viet_method">VIQR
    <input id="him_viqr2" onclick="setMethod(4);" type="radio" name="viet_method">VIQR*
    <input id="him_off" onclick="setMethod(-1);" type="radio" name="viet_method">Off
    <input id="him_ckspell" onclick="setSpell(this);" type="checkbox" name="viet_method">Check spelling
    <input id="him_daucu" onclick="setDauCu(this);" type="checkbox" name="viet_method">Old Accent
<?php
}
